<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="layer/JQuery/jquery-3.1.1.min.js"></script>
    <script src="layer/layer/layer.js"></script>
    <link rel="stylesheet" href="layui/css/layui.css"/>
    <script src="layui/layui.js"></script>

    <style>
        .layui-input-block {
            margin-right: 200px;
        }
    </style>

</head>

<body>
<form class="layui-form" th:action="@{/catalog}" method="post">

    <div class="layui-form-item" style="margin-top: 10px">
        <label class="layui-form-label">二级目录</label>
        <div class="layui-input-block">
            <input type="text" id="cname" name="cname" required lay-verify="required" autocomplete="off"
                   class="layui-input" maxlength="20">
        </div>
    </div>

    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">所属一级目录</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input type="text" id="cmemo" name="cmemo" lay-verify="required" autocomplete="off"-->
                   <!--class="layui-input" maxlength="20">-->
        <!--</div>-->
    <!--</div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">所属目录</label>
        <div class="layui-input-block">
            <select name="cmemo" lay-verify="required">
                <option></option>
                <option th:text="组织机构"  value="组织机构" ></option>
                <option th:text="人事管理"  value="人事管理"></option>
                <option th:text="师资信息"  value="师资信息"></option>
                <option th:text="劳资管理"  value="劳资管理"></option>
                <option th:text="职称与出国"  value="职称与出国"></option>
                <!--<option th:text="博士后管理"  th:value="博士后管理"></option>-->
                <option th:text="师德师风建设"  value="师德师风建设"></option>
                <!--<option th:text="服务指南"  th:value="服务指南"></option>-->
                <!--<option th:text="政策法规"  th:value="政策法规"></option>-->
                <option th:text="下载中心"  value="下载中心"></option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" id="addbutton" lay-submit="" lay-filter="demo">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <a th:href="@{/catalogs}">
                <input type="button" class="layui-btn layui-btn-primary" value="返回" style="margin-left: 9px;"></input>
            </a>
        </div>
    </div>

</form>
<script>
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });

    $("#cname").blur(function () {
        var temp = $("#cname").val();
        if(temp.replace(/[ ]/g, '')==''){
            $("#cname").val("")
        }
    });

    $("#cmemo").blur(function () {
        var temp = $("#cmemo").val();
        if(temp.replace(/[ ]/g, '')==''){
            $("#cmemo").val("")
        }
    });
</script>
</body>

</html>